package com.qiyu.admin.system.model;

import com.qiyu.framework.base.BaseModel;
import org.hibernate.validator.constraints.NotEmpty;

import javax.persistence.Column;
import javax.persistence.Table;

/**
 * 用户实体类
 *
 * @author zhangqing
 * @date 2016年08月18日
 */
@Table(name = "SYS_USER")
public class User extends BaseModel {
    /**
     * 登录名称
     */
    @Column(name="LOGIN_NAME",length = 40,nullable = false,unique =true)
    private String loginName;
    /**
     * 登录密码
     */
    @Column(name="LOGIN_PWD",length = 40,nullable = false)
    private String loginPwd;
    /**
     * 用户名称
     */
    @Column(name="USER_NAME",length = 40,nullable = false)
    @NotEmpty(message="员工名称不能为空")
    private String userName;
    /**
     * 用户编码
     */
    @Column(name="USER_CODE",length = 40,nullable = false)
    @NotEmpty(message="员工编号不能为空")
    private String userCode;
    /**
     * 用户电话
     */
    @Column(name="PHONE",length = 40,nullable = false)
    private String phone;
    /**
     * 用户所属部门
     */
    @Column(name="DEP_ID",length = 32,nullable = false)
    private String depId;
    /**
     * 邮箱
     */
    @Column(name="EMAIL",length = 40)
    private String email;
    /**
     * 用户性别
     */
    @Column(name="GENDER")
    private Integer gender;
    /**
     * 用户头像
     */
    @Column(name="PHOTO",length = 40)
    private String photo;

    /**
     * 密码加密盐值
     */
    @Column(name="SALT",length = 64)
    private String salt;//加密密码的盐

    /**
     * 密码盐.
     * @return
     */
    public String getCredentialsSalt(){
        return this.loginName+this.salt;
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt;
    }

    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    public String getLoginPwd() {
        return loginPwd;
    }

    public void setLoginPwd(String loginPwd) {
        this.loginPwd = loginPwd;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserCode() {
        return userCode;
    }

    public void setUserCode(String userCode) {
        this.userCode = userCode;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getDepId() {
        return depId;
    }

    public void setDepId(String depId) {
        this.depId = depId;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Integer getGender() {
        return gender;
    }

    public void setGender(Integer gender) {
        this.gender = gender;
    }

    public String getPhoto() {
        return photo;
    }

    public void setPhoto(String photo) {
        this.photo = photo;
    }
}
